﻿using System.Collections.Generic;
using System.Linq;

namespace CDOP.Model
{
    public class ExportCustomizationRepository
    {
        private static readonly CDOPEntities Db = new CDOPEntities();

        public List<ColumnInfo> GetByPageName(string pageName)
        {
            var columnIds = Db.PageInfo.Where(x => x.Name == pageName).Select(x => x.Id).ToList();
            var columns = Db.ColumnInfo.Where(x => columnIds.Contains(x.PageId)).ToList();
            return columns;
        }
    }
}